<template>
  <TCollapse :title="this.newPrjDetail.manageMode === '05'?'子项目列表':'单项工程列表'">
    <accButton
      v-if="type === 'todo'"
      :prj-id="prjId"
      :select-list="selectList"
      :btn-list="btnOptions"
      @getTable="getTable"
    />
    <accTable :table-header="tableHeader" :table-data="tableData" @changeCheck="handleCheck" @changeData="handleData" />
    <pagination
      :is-popper-body="false"
      :total="total"
      :page.sync="params.pageNum"
      :limit.sync="params.pageSize"
      @pagination="getTable"
    />
  </TCollapse>
</template>
<script>
import accButton from '@/views/acceptance/components/accButton.vue'
import { Mixins } from '@/views/acceptance/components/minix'
import { tableMinix } from '../tableMinix'
import accTable from '../table.vue'
import { getQueryObject } from '@/utils'
export default {
  name: 'Plan',
  components: { accButton, accTable },
  mixins: [Mixins, tableMinix],
  data() {
    return {
      type: '',
      btnList_: ['serviceShow', 'materialAffirm', 'maintain', 'createCheck', 'panorama']
    }
  },
  computed: {
    // 智联 单项工程 有实施
    getShowOne() {
      return this.newPrjDetail.isNewBusiness === '1' && this.newPrjDetail.manageMode === '31' && this.newPrjDetail.ifNewStartupProcess === '0'
    },
    getShowOneNew(){
      return this.newPrjDetail.isNewBusiness === '0'&&this.newPrjDetail.businessMajor==='04'
    },
    // 代建服务 代建类
    getShowTwo() {
      return this.newPrjDetail.prjType === 'Q' && this.newPrjDetail.buildModes === '07'
    },
    // 服务成本 设备录入
    getShowThree() {
      return this.newPrjDetail.prjType === 'W' && this.newPrjDetail.buildModes === '26'
    },
    btnList() {
      const { bizState } = this.newWorkDetail.bizObject
      // 单项工程 智联项目 代建服务
      if ((this.getShowOne||this.getShowOneNew)&& bizState === 'F5') {
        // 代建服务  服务成本
        const list = ['serviceShow', 'materialAffirm', 'createCheck', 'panorama']
        const ishow = this.getShowTwo || this.getShowThree
        // 资源确认
        return ishow ? list.filter(item => item !== 'serviceShow') : list
      } else {
        // 通信
        return this.btnList_
      }
    }
  },
  created() {
    const { type } = getQueryObject()
    this.type = type
  }
}
</script>

<style scoped lang='scss'></style>
